<template>
	<scroll-view :scroll-x="lxName==='hd'" class="pz_box cardCont" :class="lxName">
		<view v-for="(item, index) in list" :key="index" class="pz_box_item mb3"
			@click="jump2('/pages/sport/detail?id=',item.id)">
			<image class="pzImg" :src="item.img2"></image>
			<view class="pz_box_item_box">
				<view class="name" :class="lxName=='zt'?'limit-2-line':'limit-1-line'">{{item.title}}</view>
				<view v-if="showList.indexOf('1') > -1" class="time">{{item.createDate}}</view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	export default {
		props: {
			lxName: {
				type: String,
				default: 'dt'
			},
			list: {
				type: Array,
				default: () => []
			},
			showList: {
				type: Array,
				default: ()=>['1']
			},
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			}
		}

	}
</script>

<style lang="scss" scoped>
	.pz_box {
		.pzImg {
			vertical-align: top;
		}
		.pz_box_item {
			width: 100%;
			border-radius: 8rpx;
			position: relative;
			background-color: #fff;
			overflow: hidden;
			.time {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				margin-top: 10rpx;
			}

			.title {
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 1;
			}
		}

		&.dt,
		&.sx {
			.pz_box_item {
				// border: 1rpx solid #E5E5E5;

				.pzImg {
					width: 100%;
					height: 388rpx;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					padding: 20rpx;
				}
			}
		}

		&.sx {
			display: flex;
			flex-wrap: wrap;
			&:before {
				clear: both;
				content: '';
				display: block;
			}
			
			.pz_box_item {
				// border: 1rpx solid #E5E5E5;
				width: 49%;
				float: left;
				box-sizing: border-box;
				margin-right: 2%;

				&:nth-child(2n) {
					margin-right: 0;
				}

				.pzImg {
					height: 188rpx;
				}

				.pz_box_item_box {
					.title {
						overflow: hidden;
						height: 80rpx;
						margin-bottom: 20rpx;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40rpx;
						-webkit-line-clamp: 2;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}
				}

			}
		}

		&.hd {
			white-space: nowrap;
			display: flex;

			.pz_box_item {
				// border: 1rpx solid #E5E5E5;
				width: 440rpx;
				display: inline-block;
				margin-right: 30rpx;

				&:last-of-type {
					margin-right: 0;
				}

				.pzImg {
					width: 100%;
					height: 247rpx;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					background-color: #fff;
					padding: 20rpx;

					.title {
						overflow: hidden;
						margin-bottom: 10rpx;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40rpx;
						-webkit-line-clamp: 1;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}
				}
			}
		}


		&.zt {
			.pz_box_item {
				display: flex;
				background: #FFFFFF;
				box-sizing: border-box;
				padding: 20rpx;
				justify-content: space-between;

				.pzImg {
					width: 260rpx;
					border-radius: 8rpx;
					flex: none;
					height: 146rpx;
				}

				.pz_box_item_box {
					flex: 1;
					box-sizing: border-box;
					padding-left: 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
				}
			}
		}
	}
</style>